import request from '../request.ts'

// 创建考试
export const createExam = (data) => {
  return request({
    url: '/exams/create',
    method: 'post',
    data
  })
}


// 获取考试详情
export const getExam = (examId) => {
  return request({
    url: `/exams/${examId}`,
    method: 'get'
  })
}

// 获取学生考试详情（不包含答案）
export const getStudentExam = (examId) => {
  return request({
    url: `/exams/${examId}/student`,
    method: 'get'
  })
}


// 更新考试 (POST方式)
export const updateExam = (data) => {
  return request({
    url: '/exams/update',
    method: 'post',
    data
  })
}

// 更新考试 (PUT方式)
export const updateExamById = (examId, data) => {
  return request({
    url: `/exams/${examId}`,
    method: 'put',
    data
  })
}

// 删除考试 (POST方式)
export const deleteExam = (data) => {
  return request({
    url: `/exams/${data.examId}`,
    method: 'delete'
  })
}

// 删除考试 (DELETE方式)
export const deleteExamById = (examId) => {
  return request({
    url: `/exams/${examId}`,
    method: 'delete'
  })
}


// 获取我的考试列表 (GET方式)
export const getMyExamsList = () => {
  return request({
    url: '/exams/my',
    method: 'get'
  })
}
